home *** CD-ROM | disk | FTP | other *** search
- // SybaseAdaptor.h
- // Copyright 1994, NeXT Computer, Inc.
-
- #import <eoaccess/eoaccess.h>
- #import <sybfront.h>
- #import <sybdb.h>
-
- @class SybaseChannel;
-
- // Defines for keys in connection dictionary
- #define USERNAME @"userName"
- #define HOSTNAME @"hostName"
- #define DATABASENAME @"databaseName"
- #define PASSWORD @"password"
-
- // If this key is found in the connection dictionary, its corresponding
- // value is set using DBSETLCHARSET() on the sybase login structure
- // before calling dbopen().
- #define CHARSETNAME @"sybaseClientCharacterSet"
-
- // If this key is found in the connection dictionary, its corresponding
- // value is set using DBSETNATLANG() on the sybase login structure
- // before calling dbopen().
- #define NATLANGNAME @"sybaseClientLanguage"
-
- // If this key is found in the connection dictionary with a value of "Yes",
- // the adaptor enables the System 10 Password encryption feature before
- // attempting to open a connection
- #define ENCRYPTPASSWORD @"sybasePasswordEncryption"
-
- @interface SybaseAdaptor:EOAdaptor
- {
- LOGINREC *_loginRecord;
- NSMutableDictionary *_typesByName;
- NSMutableArray *_channels;
- NSMutableArray *_dbProcessPool;
- int _dbProcessPoolLimit;
- int _maxTextSizeDefault;
- struct
- {
- unsigned hasConnectedWithDictionary:1;
- unsigned shareDBProcesses:1;
- unsigned _RESERVED:30;
- } _flags;
-
- }
-
-
- // Clients can configure the Sybase Adaptor and individual Sybase Channels
- // to handle errors and messages from the Sybase server in different ways.
- // When an error or message is recieved from the server on a DBProcess that
- // has been associated with a Sybase Adaptor Channel, the channel is consulted
- // for the appropriate behavior. When no channel is present, the Sybase
- // Adaptor Class is consulted. The following methods allow clients to specify
- // different behaviors for handling errors and messages. In addition, when
- // new channels are created, they will be initialized with the current values
- // of their parent adaptor.
- + (BOOL)logsErrors;
- // YES if adaptors log errors. logsErrors is set to YES by default.
- + (void)setLogsErrors:(BOOL)yn;
- // If set to YES Sybase adaptors will log errors with severity greater
- // than severityLevelToIgnore.
-
- + (BOOL)logsMessages;
- // YES if adaptors log messages. logsMessages is set to YES by default.
- + (void)setLogsMessages:(BOOL)yn;
- // If set to YES Sybase adaptors will log messages with severity greater
- // than severityLevelToIgnore.
-
- + (int)severityLevelToIgnore;
- // Returns severity level of messages and errors that will be ignored by
- // the default error and message handling routines. The default value for
- // severityLevelToIngore is 0.
- + (void)setSeverityLevelToIgnore:(int)severityLevel;
- // Sybase adaptors will ignore any messages and errors up to and equal to
- // severityLevelToIgnore.
-
- + (void)setTimeOutInterval:(int)seconds;
- + (int)timeOutInterval;
-
- + (void)setLoginTimeOutInterval:(int)seconds;
- + (int)loginTimeOutInterval;
-
- - (int)maxTextSizeDefault;
- // Returns the maximum number of bytes to be returned from a sybase image
- // to text field. The default is set to INT_MAX as defined for the host
- // machine. This number can be overwritten on a channel by channel basis
- // by sending the appropriate SQL to the channel using the
- // evaluateExpression: method.
- - (void)setMaxTextSizeDefault:(int)textSize;
- // Sets the default testsize. Any channels created after this method has
- // been invoked will use the current textsize rather than the default.
-
- - (int)typeForName:(NSString *)typeName;
- // Returns the integer constant representing the type name as defined by
- // Sybsae
-
- // Sybase DBPROCESS structures are fairly heavyweight resources. Creating
- // and destroying them often tends to slow things down, and they are limited
- // in number by the database server. The Sybase adaptor can be configured
- // to share the DBPROCESS structs among all of its contexts. This is very
- // useful if you have created several channels but only a few are actually
- // in use simultaneously. When shareDBProcesses has been set to YES, channels
- // ask the adaptor for a DBPROCESS structure before each transaction and
- // gives the DBPROCESS back to the adaptor after each transaction has been
- // completed.
- // NOTE: When shareDBProcesses has been set to YES, you should never do
- // anything that sets the state of a DBPROCESS beyond its current transaction
- // (eg. sending the string @"set textsize 10" to a channels
- // evaluateExpression: method). This is because the DBPROCESS may be given
- // to another context in a subsequent transaction.
-
- - (BOOL)shareDBProcesses;
- // Returns yes if this adaptor has been configured to share sybase
- // DBPROCESS structs when possible. The default value for shareDBProcesses
- // is NO.
- - (void)setShareDBProcesses:(BOOL)yn;
- // Configures the adaptor to shareDBProcesses or not. Must be invoked
- // before any contexts are instantiated.
-
- - (int)dbProcessPoolLimit;
- - (void)setDBProcessPoolLimit:(int)dbProcessPoolLimit;
-
- @end
-
-